﻿using pcBLL;
using pcObjectLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;

namespace PunchClock.Helpers
{
    public static class UserHelpers
    {
        public static bool IsEditor(this IPrincipal user)
        {
            return false; //Do some stuff
        }
        public static bool IsAdmin(this IPrincipal user)
        {
            if (user.Identity.IsAuthenticated)
            {
                UserBLL UB = new UserBLL();
                var uDetails = UB.Details(user.Identity.Name);
                return uDetails.userTypeId != 1;
            }
            return false; //Do some stuff
        }

        public static bool isHumanResource(IPrincipal user)
        {
            if (user.Identity.IsAuthenticated)
            {
                UserBLL UB = new UserBLL();
                var uDetails = UB.Details(user.Identity.Name);
                return uDetails.userTypeId == (int)UserTypesEnum.HumanResources;
            }
            return false; //Do some stuff
        }
    }
}